//
//  UIButton_Extension.swift
//  WB
//
//  Created by leador on 17/3/20.
//  Copyright © 2017年 袁满. All rights reserved.
//

import UIKit

extension UIButton {
    
    
    convenience init(image:String,backgroundImage:String) {
        
        self.init()//在convenience中必须要明确的调用此函数
        
        setImage(UIImage(named:image), for: .normal)
        setImage(UIImage(named:image+"_highlighted"), for: .highlighted)
        
        setBackgroundImage(UIImage(named:backgroundImage), for: .normal)
        setBackgroundImage(UIImage(named:backgroundImage+"_highlighted"), for: .highlighted)
        sizeToFit()
        
    }
    
    convenience init(title:String, titleSize:CGFloat,backgroundColor:UIColor) {
        
        self.init()
        
        setTitle(title, for: .normal)
        titleLabel?.font = UIFont.systemFont(ofSize: titleSize)
        self.backgroundColor = backgroundColor
        
    }
}
